package GUI;

import java.awt.*;
import javax.swing.JButton;
import javax.swing.JOptionPane;
import javax.swing.JPanel;

public class PanelFunctionsOrders  extends PanelFunctionsEmpty
{

	
	private static final long serialVersionUID = 1L;
	private MainMenu mainMenu;
	private PFTelephone_orders orders;
	private JButton button_newOrder;
	private JButton button_changeOrder;	
	
public PanelFunctionsOrders(MainMenu mm,PFTelephone_orders ord)
{
	super();	
	this.mainMenu=mm;
	this.orders=ord;
	this.add(get_button_newOrder());
	this.add(get_button_changeOrder());
	
}
	
	
	
	
private JButton get_button_newOrder() 
	{
		if (button_newOrder == null) 
		{			
			button_newOrder=new JButton("הכנסת הזמנה חדשה");  			 
			button_newOrder.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));
			button_newOrder.setPreferredSize(new Dimension(220, 30));
			
			button_newOrder.addActionListener(new java.awt.event.ActionListener() 
			   {
				public void actionPerformed(java.awt.event.ActionEvent e) 
				{
					
					orders.addInsertOrderPanel(); 							
				}
			});
		}
		return button_newOrder;
	}
	
	
	//
	
private JButton get_button_changeOrder() 
	{
		if (button_changeOrder == null) 
		{			
			button_changeOrder=new JButton("עידכון פרטי הזמנה");  			 
			button_changeOrder.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));
			button_changeOrder.setPreferredSize(new Dimension(220, 30));
			
			button_changeOrder.addActionListener(new java.awt.event.ActionListener() 
			   {
				public void actionPerformed(java.awt.event.ActionEvent e) 
				{
					if (orders.getSelectedRowVec()==null)
						JOptionPane.showMessageDialog(null,"יש לבחור הזמנה ");
					else
						orders.addChangeOrderPanel();
						
						
						
				}
			});
		}
		return button_changeOrder;
	}


}